﻿using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms;
using ApplicationGenerator.Lists.BusinessLogic;

namespace GUserInterface.WinForms.Lists
{
    public partial class ConfigurationWizardForm : Form
    {
        private GUserInterface.WinForms.Lists.ListWizardConfigurationControl wizardControl;

        public ConfigurationWizardForm()
        {
            InitializeComponent();
            wizardControl = new ListWizardConfigurationControl();
            wizardControl.Dock = DockStyle.Fill;
            this.panel1.Controls.Add(wizardControl);
            wizardControl.ShowFirstPage();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            wizardControl.SaveConfiguration();

            BinaryFormatter form = new BinaryFormatter();
            MemoryStream memory = new MemoryStream();

            form.Serialize(memory, wizardControl.ConfigurationObject);

            byte[] bytes = memory.ToArray();

            memory = new MemoryStream(bytes);
            ListConfiguration conf = (ListConfiguration)form.Deserialize(memory);
        }
    }
}
